package cn.ilikes.tools.nosql.jpa;

import cn.ilikes.tools.nosql.jpa.classloads.JPASQLClassLoader;
import cn.ilikes.tools.nosql.jpa.configs.JPASQLPersistenceUnitMetadata;
import cn.ilikes.tools.nosql.jpa.metadatas.IEntityMetaDataFactory;

/**
 * 创建 JPA Hbase Persisten Unit Env .
 * 
 * @author fack
 * 
 */
public class JPASQLPersistenUnitEnv {

	private String persistenUnitName;

	private JPASQLSystemEnv systemEnv;

	private JPASQLPersistenceUnitMetadata persistenceUnitMetadata;

	private IEntityMetaDataFactory metaDataManagerFactory;

	private JPASQLClassLoader persistenUnitClassLoader;

	public JPASQLPersistenUnitEnv(String persistenUnitName, JPASQLSystemEnv systemEnv) {
		super();
		this.persistenUnitName = persistenUnitName;
		this.systemEnv = systemEnv;
	}

	public void init() {
		JPASQLClassLoader persistenUnitClassLoader = new JPASQLClassLoader(systemEnv.getjPASQLSysClassLoader());
		setPersistenUnitClassLoader(persistenUnitClassLoader);
	}

	public String getPersistenUnitName() {
		return persistenUnitName;
	}

	public JPASQLSystemEnv getSystemEnv() {
		return systemEnv;
	}

	public JPASQLPersistenceUnitMetadata getPersistenceUnitMetadata() {
		return persistenceUnitMetadata;
	}

	public void setPersistenceUnitMetadata(JPASQLPersistenceUnitMetadata persistenceUnitMetadata) {
		this.persistenceUnitMetadata = persistenceUnitMetadata;
	}

	public IEntityMetaDataFactory getMetaDataManagerFactory() {
		return metaDataManagerFactory;
	}

	public void setMetaDataManagerFactory(IEntityMetaDataFactory metaDataManagerFactory) {
		this.metaDataManagerFactory = metaDataManagerFactory;
	}

	public JPASQLClassLoader getPersistenUnitClassLoader() {
		return persistenUnitClassLoader;
	}

	public void setPersistenUnitClassLoader(JPASQLClassLoader persistenUnitClassLoader) {
		this.persistenUnitClassLoader = persistenUnitClassLoader;
	}

}
